<?php

namespace app\admin\controller;

use think\Controller;

class Cash extends Base
{
//    提现列表
    public function cashlist(){
       $cash = db()->view('cash')->view('user','mobile','cash.uid = user.id')->paginate(10);
       $this->assign('cash',$cash);
       return $this->fetch();
    }

    /**
     * 提现同意
     */
    public function accept($id){
       $res =  db('cash')->where('id',$id)->setField('status',1);
       if($res){
           $this->success('操作成功');
       }
    }

    /**
     * 提现拒绝
     */
    public function deny($did,$uid,$money){

       $inc = db('user')->where('id',$uid)->setInc('balance',$money);
       if($inc){
           $res = db('cash')->where('id',$did)->setField('status',2);
           if($res){
               $this->success('操作成功');
           }
       }
    }

}
